#! /bin/bash
lib_path=$(cd `dirname $0`; pwd)


# check libcore.dll
if [ ! -d "${lib_path}/lib/" ];then
    mkdir ${lib_path}/lib
    echo "Please copy libcore.dll to the folder ${lib_path}/lib."
    exit 1
fi

if [ ! -f "${lib_path}/lib/libcore.dll" ];then
    echo "Please copy libcore.dll to the folder ${lib_path}/lib."
    exit 1
fi

# libmymmkv.dll
cd ${lib_path}/mmkv_cpp
if [ -f "Makefile" ];then
    make clean
fi

./configure
make

# kv4cj
cd  ${lib_path}/
echo start build kv4cj
cjpm build -V
cp ${lib_path}/lib/*.dll ${lib_path}/target/release/kv4cj/
echo end build kv4cj
